package com.datareport.data.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.datareport.data.entity.DisabilityInfoPast;
import com.datareport.data.mapper.DerivedInfoMapper;
import com.datareport.data.mapper.DisabilityInfoPastMapper;
import com.datareport.data.service.DisabilityInfoPastService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author DataReport
 * @since 2021-11-18
 */
@Service
public class DisabilityInfoPastServiceImpl extends ServiceImpl<DisabilityInfoPastMapper, DisabilityInfoPast> implements DisabilityInfoPastService {

    @Autowired
    DisabilityInfoPastMapper disabilityInfoPastMapper;

    @Autowired
    DerivedInfoMapper derivedInfoMapper;

    @Autowired
    DisabilityInfoPastService disabilityInfoPastService;

    @Override
    public void saveList(List<DisabilityInfoPast> list) {

        int m = list.size();

        for (int i = 0; i < m; i++) {

            DisabilityInfoPast disabilityInfoPast = list.get(i);

            try {
                disabilityInfoPastService.saveOrUpdate(disabilityInfoPast);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }



    @Override
    public Page<DisabilityInfoPast> selectAll(Integer pageNum, Integer pageSize) {

        Page<DisabilityInfoPast> page = new Page<>(pageNum, pageSize);

        Page<DisabilityInfoPast> pageParams = disabilityInfoPastMapper.selectPage(page, null);

        return pageParams;
    }
}
